home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
pasprog.EXE
/
ANALOG.PAS
next >
Wrap
Pascal/Delphi Source File
|
1994-03-17
|
14KB
|
405 lines
Program tinaSaat; {tina Bilgisayar, Selim S. Çelik}
uses
crt,dos,graph;
label
yeniden;
const
GRAY50: FILLPATTERNTYPE=($AA,$55,$AA,$55,$AA,$55,$AA,$55);
upkey = #200;
downkey = #208;
pgupkey = #201;
pgdnkey = #209;
leftkey = #203;
inskey = #210;
rightkey = #205;
delkey = #211;
cr = #13;
esc = #27;
var
gd,gm,orx,ory,hx,hy,npx,npy,cx,cy,saatx,saaty,esev,sev : integer;
saat,dn,bs,bn,bt,bd,dd,ds : word;
x,nx1 : real;
ayartus,tus : char;
ayar : boolean;
max : byte;
ays : array [0..2] of integer;
sonuc : string;
PROCEDURE BUTTONKOY (X,Y : INTEGER; C : STRING; R: BYTE; CH : CHAR; CRN: BYTE);
VAR
UZ : INTEGER;
YER : BYTE;
BEGIN
UZ:=8*LENGTH (C)+12;
SETCOLOR (8);
RECTANGLE (X,Y,X+UZ,Y+20);
SETFILLSTYLE (1,7);
FLOODFILL (X+5,Y+5,8);
SETCOLOR (15);
MOVETO (X+1,Y+19);
LINETO(X+1,Y+1);
LINETO (X+UZ-1,Y+1);
MOVETO (X+2,Y+18);
LINETO (X+2,Y+2);
LINETO (X+UZ-2,Y+2);
SETCOLOR (8);
MOVETO (X+2,Y+19);
LINETO (X+UZ-1,Y+19);
LINETO (X+UZ-1,Y+2);
MOVETO (X+3,Y+18);
LINETO (X+UZ-2,Y+18);
LINETO (X+UZ-2,Y+3);
SETCOLOR (R);
OUTTEXTXY (X+7,Y+7,C);
YER:=POS (CH,C);
IF YER>0 THEN BEGIN
SETCOLOR (CRN);
OUTTEXTXY (X+(YER*8)-1,Y+7,CH);
END;
END;
function getkey : char;
var
c : char;
begin
c := readkey;
repeat
if c = #0 then
begin
c := readkey;
if ord(c) > 127 then
c := #0
else
getkey := chr(ord(c) + 128);
end
else
getkey := c;
until c <> #0;
end; { getkey }
PROCEDURE WRITEXY (X,Y : INTEGER; C : STRING; R1,R2: BYTE);
VAR
UZ : INTEGER;
BEGIN
UZ:=8*LENGTH (C)+12;
SETCOLOR (8);
setviewport (x,y,x+uz,y+20,clipon);
clearviewport;
setviewport (0,0,getmaxx,getmaxy,clipon);
RECTANGLE (X,Y,X+UZ,Y+20);
SETFILLSTYLE (1,R1);
FLOODFILL (X+5,Y+5,8);
RECTANGLE (X,Y,X+UZ,Y+20);
SETCOLOR (R2);
OUTTEXTXY (X+7,Y+7,C);
END;
{ana kìsìm}
BEGIN
gd:=detect;
initgraph (gd,gm,'');
saatx:=100; { saatin orijin x koordinati }
saaty:=100; { saatin orijin y koordinati }
setbkcolor (7); { zemin rengi mat beyaz }
yeniden:
setcolor (1);
setviewport (saatx,saaty,saatx+220,saaty+240,clipon);
clearviewport;
setviewport (0,0,getmaxx,getmaxy,clipon);
rectangle (saatx,saaty,saatx+220,saaty+240);
rectangle (saatx+2,saaty+2,saatx+218,saaty+238);
line (saatx,saaty+22,saatx+220,saaty+22);
setfillstyle (1,15);
floodfill (saatx+5,saaty+25,1);
line (saatx,saaty+42,saatx+220,saaty+42);
setcolor (2);
setlinestyle (solidln,0,thickwidth);
rectangle (SAATX+4,SAATY+44,SAATX+216,SAATY+236);
setlinestyle (solidln,0,normwidth);
setcolor (12);
outtextxy (saatx+10,saaty+28,'Ayar');
line (saatx+10,saaty+37,saatx+16,saaty+37);
orx:=saatx+110; ory:=saaty+140;
SETFILLPATTERN (GRAY50,11);
FLOODFILL (saatx+15,saaty+5,1);
BUTTONKOY (saatx+2,saaty+2,'■',1,' ',1);
WRITEXY ( saatx+55,saaty+2,' (c) TINASOFT ',1,15);
putpixel (orx,ory,1);
setcolor (9);
setfillstyle (1,9);
for bs:=0 to 59 do begin { saat kadrani cizildi }
x:=124.10+(bs*0.1044);
hx:=trunc(orx+75*cos(x));
hy:=trunc(ory+75*sin(x));
putpixel (hx,hy,4);
if bs in [0,5,10,15,20,25,30,35,40,45,50,55] then bar (hx-2,hy-2,hx+2,hy+2);
{ her bes dakikalik dilimler bar ile belirlendi }
end;
setwritemode (xorput); { cizim modu xorput'a cevrildi}
dn:=0;
gettime (bt,bd,bs,bn); { sistem saati tespit edildi }
setcolor (3);
x:=124.10+(bs*0.1044);
hx:=trunc(orx+75*cos(x));
hy:=trunc(ory+75*sin(x));
moveto (orx,ory);
lineto (hx,hy);
setcolor (14);
dn:=bs;
x:=124.10+(bd*0.1044);
hx:=trunc(orx+75*cos(x));
hy:=trunc(ory+75*sin(x));
moveto (hx,hy);
nx1:=124.10+((bd+15)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((bd+30)*0.1044);
npx:=trunc(orx+18*cos(nx1));
npy:=trunc(ory+18*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((bd+45)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
lineto (hx,hy);
dd:=bd;
saat:=bt;
ds:=bt;
if saat>=12 then saat:=saat-12;
saat:=trunc(saat*5);
saat:=saat+trunc(bd/12);
x:=124.10+(saat*0.1044);
hx:=trunc(orx+60*cos(x));
hy:=trunc(ory+60*sin(x));
moveto (hx,hy);
nx1:=124.10+((saat+15)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((saat+30)*0.1044);
npx:=trunc(orx+15*cos(nx1));
npy:=trunc(ory+15*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((saat+45)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
lineto (hx,hy);
repeat
gettime (bt,bd,bs,bn); { her dongude sistem saati belirleniyor }
if dn<>bs then begin { saniye son icra edilen saniyeden farkli ise}
setcolor (3);
x:=124.10+(dn*0.1044); { saniyenin bir onceki pozisyonu tespit edildi }
hx:=trunc(orx+75*cos(x)); { saniyenin uc x koordinati belirlendi }
hy:=trunc(ory+75*sin(x)); { saniyenin uc y koordinati belirlendi }
moveto (orx,ory); { sistem saat orijin noktalarina odaklandi }
lineto (hx,hy); { tespit edilen koordinatina gore saniye xor edilerek silindi }
x:=124.10+(bs*0.1044);
hx:=trunc(orx+75*cos(x)); { bir onceki islemler bu sefer cizim icin tekrarlandi }
hy:=trunc(ory+75*sin(x));
moveto (orx,ory);
lineto (hx,hy);
dn:=bs;
setcolor (14);
if dd<>bd then begin {yelkovan cizimleri gerceklestirildi }
x:=124.10+(dd*0.1044);
hx:=trunc(orx+75*cos(x));
hy:=trunc(ory+75*sin(x));
moveto (hx,hy);
nx1:=124.10+((dd+15)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((dd+30)*0.1044);
npx:=trunc(orx+18*cos(nx1));
npy:=trunc(ory+18*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((dd+45)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
lineto (hx,hy);
x:=124.10+(bd*0.1044);
hx:=trunc(orx+75*cos(x));
hy:=trunc(ory+75*sin(x));
moveto (hx,hy);
nx1:=124.10+((bd+15)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((bd+30)*0.1044);
npx:=trunc(orx+18*cos(nx1));
npy:=trunc(ory+18*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((bd+45)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
lineto (hx,hy);
saat:=ds;
if saat>=12 then saat:=saat-12; { akrep ciziliyor }
saat:=trunc(saat*5);
saat:=saat+trunc(dd/12);
x:=124.10+(saat*0.1044);
hx:=trunc(orx+60*cos(x));
hy:=trunc(ory+60*sin(x));
moveto (hx,hy);
nx1:=124.10+((saat+15)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((saat+30)*0.1044);
npx:=trunc(orx+15*cos(nx1));
npy:=trunc(ory+15*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((saat+45)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
lineto (hx,hy);
saat:=bt;
if saat>=12 then saat:=saat-12;
saat:=trunc(saat*5);
saat:=saat+trunc(bd/12);
x:=124.10+(saat*0.1044);
hx:=trunc(orx+60*cos(x));
hy:=trunc(ory+60*sin(x));
moveto (hx,hy);
nx1:=124.10+((saat+15)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((saat+30)*0.1044);
npx:=trunc(orx+15*cos(nx1));
npy:=trunc(ory+15*sin(nx1));
lineto (npx,npy);
nx1:=124.10+((saat+45)*0.1044);
npx:=trunc(orx+6*cos(nx1));
npy:=trunc(ory+6*sin(nx1));
lineto (npx,npy);
lineto (hx,hy);
ds:=bt;
dd:=bd;
end; { if dd<>bd }
end; { if dn<>bs}
if keypressed then begin
tus:=getkey;
case tus of
#27 : begin
SETWRITEMODE (COPYPUT);
closegraph;
exit;
end;
#158 : begin
ayar:=true;
setwritemode (copyput);
ays[0]:=bt;
ays[1]:=bd;
ays[2]:=bs;
writexy (saatx+4,saaty+22,'Ayar',12,15);
setviewport (saatx+3,saaty+44,saatx+100,saaty+70,clipon);
clearviewport;
setviewport (0,0,getmaxx,getmaxy,clipon);
setcolor (8);
rectangle (saatx+3,saaty+44,saatx+100,saaty+70);
for sev:=0 to 2 do begin
str (ays[sev]:2,sonuc);
writexy (sev*32+5+saatx,saaty+46,sonuc,7,9);
end;
sev:=0;
str (ays[sev]:2,sonuc);
writexy (sev*32+5+saatx,saaty+46,sonuc,15,12);
esev:=0;
repeat
ayartus:=getkey;
case ayartus of
rightkey : begin
esev:=sev;
sev :=sev+1;
if sev>2 then sev:=0;
str (ays[esev]:2,sonuc);
writexy (esev*32+5+saatx,saaty+46,sonuc,7,9);
str (ays[sev]:2,sonuc);
writexy (sev*32+5+saatx,saaty+46,sonuc,15,12);
end;
leftkey : begin
esev:=sev;
sev :=sev-1;
if sev<0 then sev:=2;
str (ays[esev]:2,sonuc);
writexy (esev*32+5+saatx,saaty+46,sonuc,7,9);
str (ays[sev]:2,sonuc);
writexy (sev*32+5+saatx,saaty+46,sonuc,15,12);
end;
upkey : begin
max:=59;
if sev=0 then max:=24;
ays[sev]:=ays[sev]-1;
if ays[sev]<0 then ays[sev]:=max;
str (ays[sev]:2,sonuc);
writexy (sev*32+5+saatx,saaty+46,sonuc,15,12);
end;
downkey : begin
max:=59;
if sev=0 then max:=24;
ays[sev]:=ays[sev]+1;
if ays[sev]>max then ays[sev]:=0;
str (ays[sev]:2,sonuc);
writexy (sev*32+5+saatx,saaty+46,sonuc,15,12);
end;
end;
until ayartus in [cr,esc];
if ayartus=cr then settime (ays[0],ays[1],ays[2],0);
goto yeniden;
end;
end;
end;
until 1=2;
END.